<template>
    <div class='navbarW'>
        <div class='nav-top'>
                <div class='item'>
                    <h3>视纪影视—专注影视项目投资信息服务</h3>
                </div>
                <div class='item'>
                    <div class='iconItem'>
                        <i class='iconfont icon-dianhua'></i>
                        <h3>VIP服务热线：<span>028-85081413</span></h3>
                        <i class='line'></i>
                    </div>
                    <div @mouseenter="openDiscipline" @mouseleave="closeDiscipline" class='iconItem'>
                        <i class='iconfont icon-guanyuwomen-shoujiduan'></i>
                        <h3 >手机视纪</h3>
                        <i class='line'></i>
                        <div @mouseenter="openDiscipline" @mouseleave="closeDiscipline" v-if='discipline' class='imgBox'>
                            <img src="../../../assets/image/qrcode.jpg" alt="">
                        </div>
                    </div>
                    <div @mouseenter="openAboutUs" @mouseleave="closeAboutUs" class='iconItem'>
                        <h3>关注我们：</h3>
                        <i class='iconfont icon-weixin-copy-copy'></i>
                        <div @mouseenter="openAboutUs" @mouseleave="closeAboutUs" v-if='aboutUs' class='imgBox'>
                            <img src="../../../assets/image/qrcode.jpg" alt="">
                        </div>
                    </div>
                </div>
        </div>
        <div class='navBottom'>
            <div class='nav'>
                <a @click='goIndex' class='logo'></a>
            </div>
            <div class='nav'>
                <ul>
                    <li v-for='(item,index) in navbarList' :key='index'>
                        <a :class="{'currentColor' : index === currentIndex}" @click='hasIndex(item,index)' href="javascript:;">{{item}}</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</template>


<script>
export default {
    name:'navbarW',
    data(){
        return {
            currentIndex:'',
            navbarList:[
                '首页','影视项目','投资指南','关于我们'
            ],
            discipline:false,
            aboutUs:false
        }
    },
    props:['navbarIndex'],
    methods:{
        openDiscipline(){
            this.discipline = true;
        },
        closeDiscipline(){
            this.discipline = false;
        },
        openAboutUs(){
            this.aboutUs = true;
        },
        closeAboutUs(){
            this.aboutUs = false;
        },
        hasIndex(name,index){
            this.currentIndex = index;
            // localStorage.setItem('index',index);
            if(name === '首页'){
                this.$router.push({name:'www'});
            }
            if(name === '影视项目'){
                this.$router.push({name:'filmprograms'});
            }
            if(name === '投资指南'){
                this.$router.push({name:'Investment'});
            }
            if(name === '关于我们'){
                this.$router.push({name:'aboutUs'});
            }
        },
        goIndex(){
            this.$router.push({name:'www'});
        }
    },
    mounted(){
        console.log(this.navbarIndex);
        this.currentIndex = this.navbarIndex;
    }
}
</script>


<style lang="less" scoped>
.navbarW{
    width: 100%;
    position: fixed;
    top: 0;
    z-index: 100;
    .nav-top{
        width: 100%;
        background: #fff;
        padding: .45rem 2rem;
        display: flex;
        justify-content: space-between;    
        .item{
            h3{
                margin: 0;
                font-size: 15px;
                font-weight: 400;
                color: rgba(49, 49, 49, 1);
                span{
                    color:#fc5945;
                    font-weight: bold;
                }
            }
        }
        .item:first-child{
            width: 40%;
        }
        .item:last-child{
            width: 60%;
            display: flex;
            justify-content: flex-end;
            .iconItem{
                display: flex;
                padding: 0 .3rem;
                margin: 0 .3rem;
                position: relative;
                .line{
                    width: 1px;
                    height: 12px;
                    display: inline-block;
                    background: #aaa;
                    position: absolute;
                    right: -.45rem;
                    top: .2rem;
                }
                .iconfont{
                    font-size: 1.3rem;
                    margin-top: -.2rem;
                    margin-right: 6px;
                }
            }
            .iconItem:first-child,.iconItem:nth-child(2){
                .iconfont{
                    color: #666;
                }
            }
            .iconItem:nth-child(2){
                .iconfont{
                    margin-right: 3px;
                }
            }
            .iconItem:last-child{
                .iconfont{
                    color: #2aa515;
                }
            }
            .iconItem:nth-child(2),.iconItem:last-child{
                cursor: pointer;
                position: relative;
            }
            .imgBox{
                width: 150px;
                height: 150px;
                position: absolute;
                z-index: 3;
                left: -5.4rem;
                top: 1.7rem;
                border-top: 1px solid #efefef;
                img{
                    width: 100%;
                    height: 100%;
                }
            }
            
        }
    }
    .navBottom{
        width: 100%;
        background: rgba(27, 24, 42, 0.86);
        padding: .3rem 2rem;
        display: flex;
        justify-content: space-between;
        .nav:first-child{
            width: 30%;
            a{
                display: block;
                width: 165px;
                height: 70px;
                background: url('../../../assets/image/logo.png') center center no-repeat;
                background-size: contain;
            }
        }
        .nav:last-child{
            width: 70%;
            display: flex;
            ul{
                width: 100%;
                display: flex;
                justify-content: flex-end;
                padding-right: 1.2rem;
                li{
                    display: flex;
                    align-items: center;
                    margin-right: 3rem;
                    a{
                        font-size: 16px;
                        color: #fff;
                    }
                }
                li:last-child{
                    margin: 0;
                }
                .currentColor{
                    color: rgb(255, 0, 0);
                }
            }
        }
    }
}
</style>
